home *** CD-ROM | disk | FTP | other *** search
- Path: fang.dsto.defence.gov.au!usenet
- Newsgroups: comp.lang.c++
- Subject: Overwriting text
- Message-ID: <3135456C.5C4B@dsto.defence.gov.au>
- From: IainJameson <Iain.Jameson@dsto.defence.gov.au>
- Date: Thu, 29 Feb 1996 16:49:24 +1030
- Organization: DSTO,Australia
- NNTP-Posting-Host: fang.dsto.defence.gov.au
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (X11; I; HP-UX A.09.01 9000/735)
-
- Hi
-
- I have a small problem.
-
- I have written a GUI in Motif & C/C++.
- One component lets the user alter some parameters - stored in
- a parameter file, the values of which I read into the appropriate
- widget - by opening a number of windows and changing things - text
- and numbers.
-
- My problem is in saving the changes.
-
- When the user uses the "save as ..." option, I copy the old parameter
- file into a new file, the new file name being specified by the user.
- Simple enough - open the original file for reading and a temp
- file for writing, make sure there is enough memory then do a fread()
- followed by an fwrite().
-
- Now, how do I alter the values that have changed?
- I've tried a few things, but nothing seems to work.
- For example, searching through the new file ( remember that at this
- point it is simply a copy of the original ) until I find a
- parameter which differs from a value typed in by the user,
- and then trying to overwrite the line with the altered value.
-
- I would appreciate any suggestions.
-
- Thanks in advance.
-
- Iain.
-